//
//  SettingHomeCell.swift
//  AIPhotoProcess
//
//  Created by aw031 on 3/12/2025.
//

import UIKit
import SnapKit

class SettingHomeCell: BaseTableViewCell {
    
     static let identifier  = "SettingHomeCELL"
    private let iconView = UIImageView()
    
    lazy private var titleLabel : UILabel = {
        let lb = UILabel()
        lb.font = FontMediumScale(16)
        lb.textColor = ColorBlack
        lb.numberOfLines = 1
        lb.adjustsFontSizeToFitWidth = true
        return lb
    }()
   
    private let arrow = UIImageView(image: KImage("grayArrowIcon"))
    
    lazy var bottomLineView : UIView = {
        let view = UIView()
        view.backgroundColor = .black.withAlphaComponent(0.1)
        return view
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
                
        backgroundColor = .clear
        contentView.addSubview(iconView)
        contentView.addSubview(titleLabel)
        contentView.addSubview(arrow)
        contentView.addSubview(bottomLineView)
        
        iconView.snp.makeConstraints { make in
            make.leading.equalToSuperview().offset(20)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(KScreenWValue(24))
        }
        
        titleLabel.snp.makeConstraints { make in
            make.leading.equalTo(iconView.snp.trailing).offset(KScreenWValue(11))
            make.centerY.equalToSuperview()
            make.top.bottom.equalToSuperview()
        }
        
        arrow.snp.makeConstraints { make in
            make.trailing.equalToSuperview().inset(KScreenWValue(20))
            make.centerY.equalToSuperview()
            make.width.height.equalTo(KScreenWValue(24))
        }
        
        bottomLineView.snp.makeConstraints { make in
            make.height.equalTo(1)
            make.leading.trailing.bottom.equalTo(0)
        }
        
    }
    
    
    required init?(coder: NSCoder) { fatalError() }
    
    
    
    func configure(title: String, iconName: String , isHiddenBottomLineView : Bool = false) {
        titleLabel.text = title
        iconView.image = KImage(iconName)
        bottomLineView.isHidden = isHiddenBottomLineView
    }
}
